//https://leetcode.cn/problems/container-with-most-water/

class Solution {
public:
    int maxArea(vector<int>& height) {
        //左右指针
        //小的那方只有两种枚举结果：高度不变，距离变小  高度变小，距离变小
        //因此可以可以直接忽略小的那方
        int left = 0, right = height.size() - 1;
        int ret = 0;
        while (left < right)
        {
            int v = min(height[left], height[right]) * (right - left);
            ret = v > ret ? v : ret;

            if (height[right] > height[left])
                left++;
            else
                right--;
        }

        return ret;

    }
};